<?php
class Admin_Form_User extends Zend_Form
{
    public function init()
    {
        $this->setName("admin");

        $id = new Zend_Form_Element_Hidden('id');
        $id->addFilter('Int');
        
        $username = new Zend_Form_Element_Text('username');
        $username->setLabel('Tên đăng nhập (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
        $username->setAttrib('size', 60);
        
        $email = new Zend_Form_Element_Text('email');
        $email->setLabel('Email (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator('EmailAddress');
        $email->setAttrib('size', 60);
        
        $password = new Zend_Form_Element_Password('password');
        $password->setLabel('Mật khẩu (*)')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
        $password->setAttrib('size', 20);
        
        $fullname = new Zend_Form_Element_Text('fullname');
        $fullname->setLabel('Tên đầy đủ')->addFilter('StripTags')->addFilter('StringTrim');
        $fullname->setAttrib('size', 60);
                
        $mobile = new Zend_Form_Element_Text('mobile');
        $mobile->setLabel('Di động')->addFilter('StripTags')->addFilter('StringTrim');
        $mobile->setAttrib('size', 20);
        
        $address = new Zend_Form_Element_Text('address');
        $address->setLabel('Địa chỉ')->addFilter('StripTags')->addFilter('StringTrim');
        $address->setAttrib('size', 60);
        
        $status = new Zend_Form_Element_Select('status');
        $status->setLabel('Trạng thái');
        $status->addMultiOption('1','Đang hoạt động');
        $status->addMultiOption('0','Tạm khóa');
        
        $gold = new Zend_Form_Element_Text('gold');
        $gold->setLabel('Tiền trong tài khoản')->addFilter('StripTags')->addFilter('StringTrim')->addFilter('Int');
        $gold->setAttrib('size', 20);
        
        $qty = new Zend_Form_Element_Text('qty');
        $qty->setLabel('Số bài đăng')->addFilter('StripTags')->addFilter('StringTrim')->addFilter('Int');
        $qty->setAttrib('size', 20);                               

        // submit button
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id','submitbutton');
        $submit->setAttrib('class',"button medium");

        // add elements to form
        $this->addElements(array (
            $id, $username, $email, $password, $mobile, $fullname, $address, $status, $gold, $qty, $submit
        ));
    }
}